/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ImagenesDBGad.IO;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author NiCo
 * http://code.google.com/p/imagenesdb-gad/source/browse/
 */
@Entity
public class Imagen implements Serializable {

    @OneToMany(mappedBy = "imagen", cascade = CascadeType.PERSIST)
    private List<Objeto> objetos = new ArrayList<Objeto>();
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String codXML;
    private String nombre;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public List<Objeto> getObjetos() {
        return objetos;
    }

    public void setObjetos(List<Objeto> objetos) {
        this.objetos = objetos;
    }

    public String getCodXML() {
        return codXML;
    }

    public void setCodXML(String codXML) {
        this.codXML = codXML;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Imagen)) {
            return false;
        }
        Imagen other = (Imagen) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Imagen{" + "id=" + id + ", nombre=" + nombre + '}';
    }
}
